//
//  HLMenuButtom.m
//  HLAerospace
//
//  Created by hulian-ios on 17/8/30.
//  Copyright © 2017年 hulian-LB. All rights reserved.
//

#import "HLMenuButton.h"

@interface HLMenuButton ()

@end

@implementation HLMenuButton


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //初始化操作
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:IS_IPHONE_5 ? 12 : 14];
        [self setTitleColor:HLRGB(60, 60, 60) forState:UIControlStateNormal];
        
        self.titleLabel.numberOfLines = 2;
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat margin = IS_IPHONE_5 ? 5 : 10;
    
    self.imageView.y = margin + 5;
    self.imageView.centerX = self.width * 0.5;
    self.titleLabel.width = self.width;
    self.titleLabel.y = CGRectGetMaxY(self.imageView.frame) + margin + 5;
    self.titleLabel.x = 0;
    self.titleLabel.height = self.height - self.titleLabel.y;

}

@end
